<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // promise API
        // 1. 调用Promise.reject() 不传参，默认返回失败promise，结果值为undefined
        // let p = Promise.reject();
        // console.log(p);

        // 2. 调用Promise.reject() 传入非promise参数，返回失败promise，结果值为参数值
        // let p = Promise.reject(123);
        // console.log(p);

        // 3. 调用Promise.reject() 传入promise参数，返回失败promise，结果值为传入的promise
        // let p = Promise.reject(new Promise((res,rej)=>{ rej('error')}));
        // let p = Promise.reject(new Promise((res,rej)=>{ res('success')}));
        // let p = Promise.reject(new Promise((res,rej)=>{}));

        //总结：Promise.reject() 只会返回失败的promise，永远不会成功！
        // 就算你传了成功promise对象，返回的还是失败，只不过结果值是成功的promise而已
        // console.log(p);


    </script>
</body>

</html>